package com.itheima.Test;

import java.util.Scanner;

public class Test005 {
    public static void main(String[] args) {
        //请编写程序，校验键盘录入的电子邮箱是否合法，并测试
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("请输入一个邮箱地址:");
            String s = sc.nextLine();
            boolean m = s.matches("\\w+[@]\\w+(.\\w+)+");
            if (m) {
                System.out.println("输入正确!");
            } else {
                System.out.println("输入有误");

            }
        }
    }
}
